{% extends 'course-manage/tasks/layout.html.twig' %}
{% do script(['libs/jquery-sortable.js','app/js/course-manage/lesson-manage/normal/index.js']) %}

{% block page_title %}
  {{ 'course.plan_task.content_title'|trans }}
  {% if course.platform == 'supplier' %}
    {% include 'lesson-manage/s2b2c-changelog.html.twig' %}
  {% endif %}
{% endblock %}
{% block main_body %}
  {% if has_permission('admin_v2_course_content_manage') or 'ROLE_TEACHER' in app.user.roles or (courseSet.parentId > 0 and has_permission('admin_v2_classroom')) %}
    <div class="js-lesson-manage">
      {% set locales = app.request.session.get('_locale',app.request.locale)|default('zh_CN') %}
      <span class="js-data-local hidden" data-local="{{ locales }}"></span>
      {% include 'lesson-manage/header.html.twig' %}
      <ul id="sortable-list" class="task-manage-list sortable-list" data-sort-url='{{ path("course_manage_items_sort",{courseId: course.id}) }}'>
        {% for key, item in items %}
          {% if item.type == 'lesson' %}
            {% include 'lesson-manage/normal/lesson.html.twig' with {lesson:item, course:course} %}
          {% else %}
            {% include 'lesson-manage/chapter/item.html.twig' with {chapter:item, course:course} %}
          {% endif %}
        {% endfor %}
      </ul>
      <div class="empty task-empty js-task-empty {% if items %} hidden {% endif %}">
        <i class="es-icon es-icon-book task-empty-icon"></i>
        {{'course.plan_task.empty'|trans}}
      </div>
      {% include 'lesson-manage/batch-operate.html.twig' with { courseId: course.id } %}
    </div>
  {% else %}
    <div class="cd-alert cd-alert-danger">{{ 'course.task_manage.no_permission_tips'|trans }}</div>
  {% endif %}
{% endblock %}
